package com.base.controller;

import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
import com.base.po.voip.ShopText;
import com.base.service.ShopTextService;

/**
 * 淘商城广告信息服务端
 * 
 * @author f
 *
 */
@Controller
@RequestMapping("/admin")
public class index_Other {

	@Autowired
	private ShopTextService shopTextService; // 广告信息

	// 其他广告首页
	@RequestMapping("/otherIndex")
	public ModelAndView otherIndex(HttpServletRequest request) throws Exception {
		String userid = (String) request.getSession().getAttribute("adminUserId"); // 登录的用户ID
		if (userid == null) return new ModelAndView("jsp/loginCheck"); // 未登录
		return new ModelAndView("jsp/index_Other", "shopText",
				shopTextService.selectByAll(new ShopText(true, null, userid)));
	}

	// 跳转添加其他广告
	@RequestMapping("/addOther")
	public String addOther() throws Exception {
		return "jsp/add_Other";
	}

	// 跳转修改广告信息
	@RequestMapping("/updateOther")
	public ModelAndView updateOther(String id) throws Exception {
		return new ModelAndView("jsp/update_Other", "shopText", shopTextService.selectByPrimaryKey(id));
	}
}
